﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Data;

namespace PJ.Business
{
    /// <summary>
    /// OrderedFragment class
    /// </summary>
    /// <typeparam name="OD">Inner data object</typeparam>
    public abstract class OrderedFragment<OD> : EntityFragment<OD>, IOrderedFragment
        where OD : IOrderedFragmentData
    {
        public OrderedFragment(OD data)
            : base(data)
        {
        }
        public OrderedFragment()
        {
        }

        public double Order
        {
            get
            {
                return ObjectData.Order;
            }
            set
            {
                if (ObjectData.Order != value)
                {
                    ObjectData.Order = value;
                }
            }
        }
        public override void CopyFrom(IBusinessObject data)
        {
            base.CopyFrom(data);
            IOrderedFragment idata = data as IOrderedFragment;
            if (idata != null)
            {
                this.Order = idata.Order;
            }
        }

    }
}

